<?php
namespace Manage\Controller;
use Common\Controller\ManageBaseController;
use Think\Model;
use Common\Model\UserModel;

class IndexController extends ManageBaseController {
	public function index() {
		$this->display();
	}
	
	//菜单树json
	public function menuTree() {
		$tree = array(
				array("text"=>"商家管理","iconCls"=>"icon-base","children"=>array(
						array("text"=>"商家列表","attributes"=>array("url"=>U('Shang/lists?cate=1'))),
						array("text"=>"充值记录","attributes"=>array("url"=>U('Chongzhi/lists'))),
				)),
				array("text"=>"刷手管理","iconCls"=>"icon-base","children"=>array(
						array("text"=>"刷手列表","attributes"=>array("url"=>U('Shua/lists?cate=2'))),
						array("text"=>"淘宝号审核","attributes"=>array("url"=>U('Taobao/lists'))),
				)),
				array("text"=>"文章管理","iconCls"=>"icon-menu","children"=>array(
						array("text"=>"网站新闻","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=1'))),
						array("text"=>"新手问答","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=2'))),
						array("text"=>"视频教程","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=3'))),
						array("text"=>"图文教程","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=4'))),
						array("text"=>"刷手教程","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=5'))),
						array("text"=>"行业新闻","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=6'))),
						array("text"=>"刷手公告","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=8& type=gonggao'))),
						array("text"=>"商家公告","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=9& type=gonggao'))),
						array("text"=>"首页大图","iconCls"=>"","attributes"=>array("url"=>U('Article/lists?cid=10& type=img'))),
				)),
				array("text"=>"任务管理","iconCls"=>"icon-menu","children"=>array(
						array("text"=>"任务列表","iconCls"=>"","attributes"=>array("url"=>U('Renwu/lists'))),
						array("text"=>"放款申请","iconCls"=>"","attributes"=>array("url"=>U('Fangkuan/lists'))),
						array("text"=>"提现记录","attributes"=>array("url"=>U('Tixian/lists'))),
				)),
				array("text"=>"系统设置","iconCls"=>"icon-gears","children"=>array(
						array("text"=>"系统参数配置","attributes"=>array("url"=>U('Config/lists'))),
				)),
		);
		$this->ajaxReturn($tree);
	}
	

	/**
	 * user 修改密码 接口
	 * @param string $org	原始密码
	 * @param string $new	新密码
	 * @param string $renew	确认新密码
	 */
	public function chgPwd($org,$new,$renew) {
		if (empty($org) || empty($new)) {
			$this->error('密码不能为空','',true);
		}
		if ($new!==$renew) {
			$this->error('新密码两次输入不一致','',true);
		}
		$user_M = new UserModel();
		if (false === $user_M->chgPwd($org, $new)) {
			$this->error($user_M->getError(),'',true);
		}
		$this->success('密码修改成功！','',true);
	}
	
	
}